package triannon.client.sprites.renderer;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Stroke;

import triannon.client.util.timer.TTimer;
import triannon.client.util.timer.TTimerListener;

public class GoToRenderer implements TTimerListener {
	private static final Color SELECTION_COLOR = new Color(200, 200, 200, 200);
	private static BasicStroke STROKE = new BasicStroke(2, BasicStroke.CAP_ROUND,
			BasicStroke.JOIN_BEVEL, 0, new float[] { 8.0f, 5.0f }, 0.0f);
	private float dashPhase = 0f;

	public GoToRenderer() {
		TTimer.getInstance().addSTimerListener(this);
	}

	public void paint(Graphics2D g, int x, int y, int goToX, int goToY) {
		Stroke orgStroke = g.getStroke();

		g.setColor(SELECTION_COLOR);
		g.setStroke(STROKE);
		g.drawLine(goToX, goToY, x, y);

		g.setStroke(orgStroke);

		g.fillOval(goToX - 3, goToY - 2, 6, 4);
	}

	@Override
	public void update(long tpf) {
		dashPhase += 1f;

		STROKE = new BasicStroke(2, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL,
				0, new float[] { 8.0f, 5.0f }, dashPhase);
	}
}
